package Sort;

import java.util.Scanner;

/**
 * @author fly
 * @create 2021--03--16--10:38
 */
public class Acwing801 {

    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
       // int[] a=new int[n];
        int[] ans=new int[n];
        for(int i=0;i<n;i++){
            int a=sc.nextInt();
            ans[i]=helper(a);
        }
        for(int i=0;i<n;i++){
            System.out.println(ans[i]);
        }
    }
    public static int helper(int x){
        int cnt=0;
        while(x>0){
            if((x&1)>0)cnt++;
            x=x>>1;
        }
        return cnt;
    }
}
